package testcase;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import junit.framework.TestCase;
import org.junit.Test;

import view.EnrollmentView;
import information.Line;

/**
 * @author Lo Ng (52431461), Lusinda Leung (52571783)
 * @version for EnrollmentViewTest v3.1.2
 * @since 05-04-2013
 */

public class EnrollmentViewTest extends TestCase {

	private final ByteArrayOutputStream OUT = new ByteArrayOutputStream();
	private final String ENTER = System.lineSeparator();

	// The constructor of the test case class
	public EnrollmentViewTest(String name) {
		super(name);
	}

	// tests for manuallyInitilizePiers()
	public void testManuallyInitilizePiers_normal() {
		String inputData = "3" + ENTER + "1" + ENTER + "2" + ENTER + "3"
				+ ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result[] = eV.manuallyInitializePiers();
		assertEquals(
				"Please input the number of piers: "
						+ "Please input the size of Pier 01 (1: Small, 2: Middle, 3: Large): "
						+ "Please input the size of Pier 02 (1: Small, 2: Middle, 3: Large): "
						+ "Please input the size of Pier 03 (1: Small, 2: Middle, 3: Large): ",
				OUT.toString());
		assertEquals(1, result[0]);
		assertEquals(2, result[1]);
		assertEquals(3, result[2]);
	}

	public void testManuallyInitilizePiers_largeANDsmall() {
		String inputData = "0" + ENTER + "1" + ENTER + "0" + ENTER + "4"
				+ ENTER + "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result[] = eV.manuallyInitializePiers();
		assertEquals(
				"Please input the number of piers: "
						+ "INVALID INPUT"
						+ ENTER
						+ ENTER
						+ "Please input the number of piers: "
						+ "Please input the size of Pier 01 (1: Small, 2: Middle, 3: Large): "
						+ "INVALID INPUT"
						+ ENTER
						+ ENTER
						+ "Please input the size of Pier 01 (1: Small, 2: Middle, 3: Large): "
						+ "INVALID INPUT"
						+ ENTER
						+ ENTER
						+ "Please input the size of Pier 01 (1: Small, 2: Middle, 3: Large): ",
				OUT.toString());
		assertEquals(1, result[0]);
	}

	public void testManuallyInitilizePiers_invalid() {
		String inputData = ENTER + "1" + ENTER + "z" + ENTER + "3" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result[] = eV.manuallyInitializePiers();
		assertEquals(
				"Please input the number of piers: "
						+ "INVALID INPUT"
						+ ENTER
						+ ENTER
						+ "Please input the number of piers: "
						+ "Please input the size of Pier 01 (1: Small, 2: Middle, 3: Large): "
						+ "INVALID INPUT"
						+ ENTER
						+ ENTER
						+ "Please input the size of Pier 01 (1: Small, 2: Middle, 3: Large): ",
				OUT.toString());
		assertEquals(3, result[0]);
	}

	// tests for selectPier(int)
	@Test
	public void testSelectPier_normal() {
		String inputData = "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectPier(1);
		assertEquals(ENTER + "Please input the pier no.(1 - 1): ",
				OUT.toString());
		assertEquals(0, result);
	}

	@Test
	public void testSelectPier_large() {
		String inputData = "3" + ENTER + "2" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectPier(2);
		assertEquals(
				ENTER + "Please input the pier no.(1 - 2): " + "INVALID PIER"
						+ ENTER + "Please input the pier no.(1 - 2): ",
				OUT.toString());
		assertEquals(1, result);
	}

	@Test
	public void testSelectPier_small() {
		String inputData = "0" + ENTER + "2" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectPier(3);
		assertEquals(
				ENTER + "Please input the pier no.(1 - 3): " + "INVALID PIER"
						+ ENTER + "Please input the pier no.(1 - 3): ",
				OUT.toString());
		assertEquals(1, result);
	}

	@Test
	public void testSelectPier_null() {
		String inputData = ENTER + "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectPier(4);
		assertEquals(ENTER + "Please input the pier no.(1 - 4): "
				+ "INVALID INPUT" + ENTER
				+ "Please input the pier no.(1 - 4): ", OUT.toString());
		assertEquals(0, result);
	}

	@Test
	public void testSelectPier_invalid() {
		String inputData = "z" + ENTER + "5" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectPier(5);
		assertEquals(ENTER + "Please input the pier no.(1 - 5): "
				+ "INVALID INPUT" + ENTER
				+ "Please input the pier no.(1 - 5): ", OUT.toString());
		assertEquals(4, result);
	}

	// tests for selectLine(int)
	@Test
	public void testSelectLine_normal() {
		String inputData = "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectLine(1);
		assertEquals("Please input the line no.(1 - 1): ", OUT.toString());
		assertEquals(0, result);
	}

	@Test
	public void testSelectLine_noLine() {
		System.setOut(new PrintStream(OUT));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectLine(0);
		assertEquals("No line is assigned to this pier." + ENTER,
				OUT.toString());
		assertEquals(-1, result);
	}

	@Test
	public void testSelectLine_large() {
		String inputData = "3" + ENTER + "2" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectLine(2);
		assertEquals("Please input the line no.(1 - 2): " + "INVALID LINE"
				+ ENTER + "Please input the line no.(1 - 2): ", OUT.toString());
		assertEquals(1, result);
	}

	@Test
	public void testSelectLine_small() {
		String inputData = "0" + ENTER + "2" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectLine(3);
		assertEquals("Please input the line no.(1 - 3): " + "INVALID LINE"
				+ ENTER + "Please input the line no.(1 - 3): ", OUT.toString());
		assertEquals(1, result);
	}

	@Test
	public void testSelectLine_null() {
		String inputData = ENTER + "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectLine(4);
		assertEquals("Please input the line no.(1 - 4): " + "INVALID INPUT"
				+ ENTER + "Please input the line no.(1 - 4): ", OUT.toString());
		assertEquals(0, result);
	}

	@Test
	public void testSelectLine_invalid() {
		String inputData = "5th" + ENTER + "5" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		int result = eV.selectLine(5);
		assertEquals("Please input the line no.(1 - 5): " + "INVALID INPUT"
				+ ENTER + "Please input the line no.(1 - 5): ", OUT.toString());
		assertEquals(4, result);
	}

	// tests for askForModification()
	@Test
	public void testAskForModification_normal_yes() {
		String inputData = "Y" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.askForModification();
		assertEquals(ENTER + "Do you want to modify this line? (Y/N): ",
				OUT.toString());
		assertEquals(true, result);
	}

	public void testAskForModification_normal_no() {
		String inputData = "N" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.askForModification();
		assertEquals(ENTER + "Do you want to modify this line? (Y/N): ",
				OUT.toString());
		assertEquals(false, result);
	}

	public void testAskForModification_null() {
		String inputData = ENTER + "y" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.askForModification();
		assertEquals(ENTER + "Do you want to modify this line? (Y/N): "
				+ "INVALID OPTION" + ENTER + ENTER
				+ "Do you want to modify this line? (Y/N): ", OUT.toString());
		assertEquals(true, result);
	}

	public void testAskForModification_invalid() {
		String inputData = "no" + ENTER + "m" + ENTER + "n" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.askForModification();
		assertEquals(ENTER + "Do you want to modify this line? (Y/N): "
				+ "INVALID OPTION" + ENTER + ENTER
				+ "Do you want to modify this line? (Y/N): " + "INVALID OPTION"
				+ ENTER + ENTER + "Do you want to modify this line? (Y/N): ",
				OUT.toString());
		assertEquals(false, result);
	}

	// tests for getLineInfoFromUser(boolean)
	@Test
	public void testGetLineInfoFromUser_normal_new() {
		String inputData = "13:00" + ENTER + "1" + ENTER + "15" + ENTER + "1"
				+ ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		Line result = eV.getLineInfoFromUser(true);
		assertEquals(
				"Please enter the start time of line (HH:MM): "
						+ "Please enter the total number of runs: "
						+ "Please enter the duration of each stop (mins): "
						+ "Please enter the size of the ship (1: Small, 2: Middle, 3: Large): ",
				OUT.toString());
		assertEquals(1300, result.getStartTime());
		assertEquals(1, result.getRuns());
		assertEquals(15, result.getDuration());
		assertEquals(1, result.getSizeOfShip());
	}

	@Test
	public void testGetLineInfoFromUser_normal_nonNew() {
		String inputData = "13:00" + ENTER + "2" + ENTER + "20" + ENTER + "15"
				+ ENTER + "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		Line result = eV.getLineInfoFromUser(false);
		assertEquals(
				"Please enter the start time of line (HH:MM): "
						+ "Please enter the total number of runs: "
						+ "Please enter the frequency of runs (mins): "
						+ "Please enter the duration of each stop (mins): "
						+ "Please enter the size of the ship (1: Small, 2: Middle, 3: Large): ",
				OUT.toString());
		assertEquals(1300, result.getStartTime());
		assertEquals(2, result.getRuns());
		assertEquals(20, result.getFreq());
		assertEquals(15, result.getDuration());
		assertEquals(1, result.getSizeOfShip());
	}

	@Test
	public void testGetLineInfoFromUser_null_new() {
		String inputData = ENTER + "13:00" + ENTER + ENTER + "2" + ENTER
				+ ENTER + "20" + ENTER + ENTER + "15" + ENTER + ENTER + "1"
				+ ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		Line result = eV.getLineInfoFromUser(true);
		assertEquals(
				"Please enter the start time of line (HH:MM): "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the start time of line (HH:MM) again: "
						+ "Please enter the total number of runs: "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the total number of runs again: "
						+ "Please enter the frequency of runs (mins): "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the frequency of runs (mins) again: "
						+ "Please enter the duration of each stop (mins): "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the duration of each stop (mins) again: "
						+ "Please enter the size of the ship (1: Small, 2: Middle, 3: Large): "
						+ "INVALID INPUT" + ENTER
						+ "Please enter the size fo the ship again: ",
				OUT.toString());
		assertEquals(1300, result.getStartTime());
		assertEquals(2, result.getRuns());
		assertEquals(20, result.getFreq());
		assertEquals(15, result.getDuration());
		assertEquals(1, result.getSizeOfShip());
	}

	@Test
	public void testGetLineInfoFromUser_null_nonNew() {
		String inputData = ENTER + ENTER + ENTER + ENTER + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		Line result = eV.getLineInfoFromUser(false);
		assertEquals(
				"Please enter the start time of line (HH:MM): "
						+ "Please enter the total number of runs: "
						+ "Please enter the frequency of runs (mins): "
						+ "Please enter the duration of each stop (mins): "
						+ "Please enter the size of the ship (1: Small, 2: Middle, 3: Large): ",
				OUT.toString());
		assertEquals(-1, result.getStartTime());
		assertEquals(-1, result.getRuns());
		assertEquals(-1, result.getFreq());
		assertEquals(-1, result.getDuration());
		assertEquals(-1, result.getSizeOfShip());
	}

	@Test
	public void testGetLineInfoFromUser_invalid() {
		String inputData = "1300" + ENTER + "13:00" + ENTER + "-1" + ENTER
				+ "2" + ENTER + "-20" + ENTER + "20" + ENTER + "-15" + ENTER
				+ "15" + ENTER + "-1" + ENTER + "1" + ENTER;
		System.setOut(new PrintStream(OUT));
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		Line result = eV.getLineInfoFromUser(true);
		assertEquals(
				"Please enter the start time of line (HH:MM): "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the start time of line (HH:MM) again: "
						+ "Please enter the total number of runs: "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the total number of runs again: "
						+ "Please enter the frequency of runs (mins): "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the frequency of runs (mins) again: "
						+ "Please enter the duration of each stop (mins): "
						+ "INVALID INPUT"
						+ ENTER
						+ "Please enter the duration of each stop (mins) again: "
						+ "Please enter the size of the ship (1: Small, 2: Middle, 3: Large): "
						+ "INVALID INPUT" + ENTER
						+ "Please enter the size fo the ship again: ",
				OUT.toString());
		assertEquals(1300, result.getStartTime());
		assertEquals(2, result.getRuns());
		assertEquals(20, result.getFreq());
		assertEquals(15, result.getDuration());
		assertEquals(1, result.getSizeOfShip());
	}

	// tests for getInputStartTime(boolean)
	@Test
	public void testGetInputStartTime_normal_new() {
		String inputData = "11:00" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(true);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputStartTime_normal_nonNew() {
		String inputData = "11:00" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputStartTime_null_new() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputStartTime_null_nonNew() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputStartTime_invalid() {
		String inputData = "1100" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputStartTime_largeHH() {
		String inputData = "26:00" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputStartTime_smallHH() {
		String inputData = "-1:00" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputStartTime_largeMM() {
		String inputData = "00:70" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputStartTime_smallMM() {
		String inputData = "00:-1" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputStartTime(false);
		assertEquals(false, result);
	}

	// tests for getInputNumberOfRuns(boolean)
	@Test
	public void testGetInputNumberOfRuns_normal_new() {
		String inputData = "10" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputNumberOfRuns(true);
		assertEquals(true, result);
	}

	public void testGetInputNumberOfRuns_normal_nonNew() {
		String inputData = "10" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputNumberOfRuns(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputNumberOfRuns_null_new() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputNumberOfRuns(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputNumberOfRuns_null_nonNew() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputNumberOfRuns(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputNumberOfRuns_large() {
		String inputData = "1441" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputNumberOfRuns(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputNumberOfRuns_small() {
		String inputData = "-10" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputNumberOfRuns(true);
		assertEquals(false, result);
	}

	// tests for getInputFrequency(boolean)
	@Test
	public void testGetInputFrequency_normal_new() {
		String inputData = "2" + ENTER + "15" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(false);
		boolean result = eV.getInputFrequency(true);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputFrequency_normal_nonNew() {
		String inputData = "2" + ENTER + "15" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(false);
		boolean result = eV.getInputFrequency(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputFrequency_null_new() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputFrequency(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputFrequency_null_nonNew() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputFrequency(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputFrequency_large() {
		String inputData = "2" + ENTER + "7000" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(false);
		boolean result = eV.getInputFrequency(false);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputFrequency_small() {
		String inputData = "2" + ENTER + "0" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(false);
		boolean result = eV.getInputFrequency(false);
		assertEquals(false, result);
	}

	// tests for getInputDuration(boolean)
	@Test
	public void testGetInputDuration_normal_new() {
		String inputData = "2" + ENTER + "24" + ENTER + "10" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(false);
		eV.getInputFrequency(false);
		boolean result = eV.getInputDuration(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputDuration_normal_nonNew() {
		String inputData = "5" + ENTER + "30" + ENTER + "30" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(true);
		eV.getInputFrequency(true);
		boolean result = eV.getInputDuration(true);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputDuration_null_new() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputDuration(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputDuration_null_nonNew() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputDuration(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputDuration_large() {
		String inputData = "2" + ENTER + "24" + ENTER + "70" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		eV.getInputNumberOfRuns(false);
		eV.getInputFrequency(false);
		boolean result = eV.getInputDuration(false);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputDuration_small() {
		String inputData = "-1" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputDuration(false);
		assertEquals(false, result);
	}

	// tests for getInputShipSize
	@Test
	public void testGetInputShipSize_normal_new() {
		String inputData = "1" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputShipSize(true);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputShipSize_normal_nonNew() {
		String inputData = "3" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputShipSize(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputShipSize_null_new() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputShipSize(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputShipSize_null_nonNew() {
		String inputData = ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputShipSize(false);
		assertEquals(true, result);
	}

	@Test
	public void testGetInputShipSize_large() {
		String inputData = "4" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputShipSize(true);
		assertEquals(false, result);
	}

	@Test
	public void testGetInputShipSize_small() {
		String inputData = "0" + ENTER;
		System.setIn(new java.io.ByteArrayInputStream(inputData.getBytes()));
		EnrollmentView eV = new EnrollmentView();
		boolean result = eV.getInputShipSize(true);
		assertEquals(false, result);
	}

	// test for getFrequency() function
	@Test
	public void testGetFrequency() {
		EnrollmentView eV = new EnrollmentView();
		int result = eV.getFrequency();
		assertEquals(-1, result);
	}

	// test for getNumberOfRuns() function
	@Test
	public void testGetNumberOfRuns() {
		EnrollmentView eV = new EnrollmentView();
		int result = eV.getNumberOfRuns();
		assertEquals(-1, result);
	}

	// test for getDuration() function
	@Test
	public void testGetDuration() {
		EnrollmentView eV = new EnrollmentView();
		int result = eV.getDuration();
		assertEquals(-1, result);
	}

	// test for getShipSize() function
	@Test
	public void testGetShipSize() {
		EnrollmentView eV = new EnrollmentView();
		int result = eV.getShipSize();
		assertEquals(-1, result);
	}

	// test for getGetStartTime() function
	@Test
	public void testGetStartTime() {
		EnrollmentView eV = new EnrollmentView();
		int result = eV.getStartTime();
		assertEquals(0, result);
	}
}